function h = disp_dfd (s, n)

   ## usage: h = disp_dfd (s, n)
   ## 
   ## display defined data

   global BATCH

   if nargin < 2, n = 2 ; endif

   [nr nc] = size(s.x) ;

   Idfd = !isnan(s.x) ;

   if BATCH
      graphics_toolkit gnuplot ; h = figure("visible", "off") ;
   else
      h = figure ;
   endif


   if strcmp(graphics_toolkit, "gnuplot")

      subplot(n, 1, 1) ;
      t = pltid(s.id)' ;
      imagesc(t([1 end]), [1 nc], Idfd') ;
      fs = round(get(gca, "fontsize") *  10/nc);
      set(gca, "xminortick", "on", "ytick", 1:nc, "yticklabel", s.ids, "fontsize", fs) ;
      xlim = get(gca, "xlim") ;

      if n > 1
	 subplot(n, 1, n) ;
	 plot(t, sum(Idfd, 2)) ;
	 set(gca, "xlim", xlim) ;
      endif

   else

      subplot(n, 1, 1) ;
      t = dateax(s.id)' ;
      imagesc(t([1 end]), [1 nc], Idfd') ;
      datetick("x") ;
      fs = round(get(gca, "fontsize") *  10/nc);
      set(gca, "xminortick", "on", "ytick", 1:nc, "yticklabel", s.ids, "fontsize", fs) ;
      xlim = get(gca, "xlim") ;

      if n > 1
	 subplot(n, 1, n) ;
	 plot(t, sum(Idfd, 2)) ;
	 datetick("x") ;
	 set(gca, "xlim", xlim) ;
      endif

   endif

   colormap([0.7 0.7 0.7; 0 0 1])

endfunction
